package org.ly817.my.spring.core.ioc.bean;

/**
 * 作为beanDefinition中，bean注入属性的描述
 * Created by LuoYu on 2018/4/9.
 */
public class PropertyValue {
    private final String name;

    private final Object value;

    private BeanReference beanReference;

    public PropertyValue(String name, Object value) {
        this.name = name;
        this.value = value;
    }

    public PropertyValue(String name, Object value, String refBeanName) {
        this.name = name;
        this.value = value;
        this.beanReference = new BeanReference(refBeanName);

    }

    public String getName() {
        return name;
    }

    public Object getValue() {
        return value;
    }

    public BeanReference getBeanReference() {
        return beanReference;
    }

    /**
     * 此处可以直接用String，留出其他信息的空间
     */
    public class BeanReference {
        private final String refBeanName;

        public BeanReference(String refBeanName) {
            this.refBeanName = refBeanName;
        }

        public String getRefBeanName() {
            return refBeanName;
        }
    }
}
